home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
TASEXAM6.ARJ
/
TITANIC.TAS
< prev
next >
Wrap
Text File
|
1991-08-21
|
7KB
|
209 lines
{ TITANIC.TAS
This script follows the trading strategy described in the
Equis "Monitor" (Vol. 6, No. 2, July 1991) article titled
"How to Avoid Sinking with the Titanic" by William Ohama.
-----------------------------------------------------
To run this, you should have a ticker file containing
only the following tickers
DJ-30 Dow 30 Industrials
-----------------------------------------------------
This script assumes that the following ticker names are
used for the indices shown at right.
NYNH - NYSE New High Issues
NYNL - NYSE New Low Issues
NYAD - NYSE ADV Issues
NYDE - NYSE DEC Issues
}
{#SCAN_DATE 790102 851231 if using TAS 4.04, you can do this}
#OUTPUT_FILE 'TITANIC.LST'
#PROFIT_TEST BOTH 5000 N
#PROFIT_COMM NOCOMM ONESHARE 0 - TODAYS CLOSE
#PROFIT_OUTPUT DETAIL
GRAPH_IT = 0; { Set to 1 to see graphs}
NYADname = 'NYAD'; { Change to your NYSE Adv Issues ticker}
NYDEname = 'NYDE'; { Change to your NYSE Dec Issues ticker}
NYNHname = 'NYNH'; { Change to your NYSE New Highs ticker}
NYNLname = 'NYNL'; { Change to your NYSE New Lows ticker}
NYAD : ARRAY; { advancing issues}
NYDE : ARRAY; { declining issues}
NYNH : ARRAY; { New High issues}
NYNL : ARRAY; { New Low issues}
{ Computed values follow here }
NHNL : ARRAY; { New Highs - New Lows}
DJHIGH : ARRAY; { 52 Week DJIA High}
COUNT_ARRAY : ARRAY; { Array to use to count > 1000 issue days}
buy_rule_1 : number; { 10% drop in the DJIA from 52 week high}
sell_rule_1 : number; { DJIA makes a 52 week high}
buy_signal : number; { Set to 1, 2, or 3 for rules which hit}
sell_signal : number; { Set to 1 or 2 for sell rules}
sell_price : number; { used for Stop/Reversal }
sell_date : number; { used to hold date of SELL 52 week high}
over_1000_days : number; { number of days of >1000 AD or DE}
day_of_52_week_high : number; { saves day of 52 week high}
PLOT BEGIN
IF CHARTPRO_FLAG = 0 THEN
BEGIN
NYAD = LOAD(NYADname,'C');
NYDE = LOAD(NYDEname,'C');
NYNH = LOAD(NYNHname,'C');
NYNL = LOAD(NYNLname,'C');
END
ELSE
BEGIN
if ticker = NYADname then
NYAD = C; { #issues in the CLOSE field}
if ticker = NYDEname then
NYDE = C; { #issues in the CLOSE field}
if ticker = NYNHname then
NYNH = C; { #issues in the CLOSE field}
if ticker = NYNLname then
NYNL = C; { #issues in the CLOSE field}
END;
if last_ticker = 1 then
BEGIN
NHNL = SUB(NYNH,NYNL);
DJHIGH = HHV(H,52*5); { 52 Week highs}
{dump_array(H,L,C,nyad,nyde,nynh,nynl,djhigh);}
END;
END;
if last_ticker = 0 then return;
{----------COMPUTATION HERE --------------}
{ Buy signals are done here---------------}
buy_signal = 0; { indicate no buy signal}
If L < DJHIGH * .9 then
buy_rule_1 = 1;
if buy_rule_1 then
{
NYSE Advancing > 1000 for two consecutive days and one of
those days shows Advance/Decline ratio > 4.00
}
if NYAD[-1] > 1000 and NYAD > 1000 and
((NYAD[-1]/NYDE[-1] > 4) OR (NYAD/NYDE > 4)) then
buy_signal = 1
else
{ the Advance/Decline ration > 9.00 or < 0.11}
if NYAD/NYDE > 9.00 or NYAD/NYDE < 0.11 then
buy_signal = 2
else
begin
COUNT_ARRAY = NYAD; { copy NYAD to COUNT_ARRAY}
gosub COUNT_1000_DAYS;
if over_1000_days >= 4 then
buy_signal = 3;
end;
if buy_signal <> 0 then
begin
if PT_BUY() <> 0 then
begin
write('^BUY-');
if buy_signal = 1 then
writeln('4 of 7 days after ',
DATESTR(DATES[day_of_52_week_high]),
' NYAD > 1000 for 2 consecutive days');
if buy_signal = 2 then
writeln('After ',
DATESTR(DATES[day_of_52_week_high]),
' AD/DE Ratio > 9 or less than 0.11');
if buy_signal = 3 then
writeln('After ',
DATESTR(DATES[day_of_52_week_high]),
' 4 of 7 days where NYAD > 1000');
buy_signal = 0;
buy_rule_1 = 0;
sell_price = 0;
return; { skip sell signal since we made a buy}
end;
end;
{ Sell signals are done here---------------}
sell_signal = 0; { indicate no signal}
if H = DJHIGH then { if today's DJ30 is the 52 week high}
begin
day_of_52_week_high = quote_count; { save current index}
sell_rule_1 = 1; { first condition met}
buy_rule_1 = 0; { remove buy alert and wait for drop}
end;
if sell_price <> 0 then
begin
if H > (sell_price * 1.02) then
begin
PT_BUY();
writeln('^BUY-Sell Signal reversal to Buy Signal',h,' > 1.02 *',
sell_price,' on ',datestr(sell_date));
sell_rule_1 = 0;
sell_price = 0;
return; { skip sell signal since we made a buy}
end;
end;
if sell_rule_1 then
begin
gosub CHECK_NL_GT_NH;
if new_lows_exceeded_new_highs then
begin
{ NYSE Declining > 1000 for two consecutive days and one of those
days shows Advance/Decline ratio < 0.25}
if NYDE[-1] > 1000 and NYDE > 1000 and
((NYAD[-1]/NYDE[-1] < 0.25) OR (NYAD/NYDE < 0.25)) then
sell_signal = 1
{ OR 4 out of 7 day period where the NYSE Declining Issues > 1000}
COUNT_ARRAY = NYDE; { copy NYDE to COUNT_ARRAY}
gosub COUNT_1000_DAYS; { count the days > 1000}
if over_1000_days >= 4 then
sell_signal = 2;
end;
if sell_signal <> 0 then
begin
if PT_SELL() <> 0 then
begin
sell_price = DJHIGH[day_of_52_week_high]; { Save high DJIA here}
sell_date = dates[day_of_52_week_high]; { save sell date}
write('^SELL-');
if sell_signal = 1 then
writeln('7 days about ',
DATESTR(DATES[day_of_52_week_high]),
' NL > NH & NYDE > 1000 for 2 days with AD/DE<.25');
if sell_signal = 2 then
writeln('4 of 7 days after ',
DATESTR(DATES[day_of_52_week_high]),
' where NYDE > 1000');
sell_signal = 0;
sell_rule_1 = 0;
end;
end;
return;
:COUNT_1000_DAYS
{ Subroutine to count the number of days in the
last 7 where NYSE Advancing Issues > 1000 }
over_1000_days = 0;
if COUNT_ARRAY[-6] > 1000 then
over_1000_days = over_1000_days+1;
if COUNT_ARRAY[-5] > 1000 then
over_1000_days = over_1000_days+1;
if COUNT_ARRAY[-4] > 1000 then
over_1000_days = over_1000_days+1;
if COUNT_ARRAY[-3] > 1000 then
over_1000_days = over_1000_days+1;
if COUNT_ARRAY[-2] > 1000 then
over_1000_days = over_1000_days+1;
if COUNT_ARRAY[-1] > 1000 then
over_1000_days = over_1000_days+1;
if COUNT_ARRAY[0] > 1000 then
over_1000_days = over_1000_days+1;
return;
:CHECK_NL_GT_NH
day_index = day_of_52_week_high - 7;
new_lows_exceeded_new_highs = 0;
:check_nl_gt_nh1
if day_index > quote_count then return;
if day_index > (day_of_52_week_high+7) then return;
if NYNL[day_index] > NYNH[day_index] then
begin
new_lows_exceeded_new_highs = new_lows_exceeded_new_highs + 1;
end;
day_index = day_index + 1;
goto check_nl_gt_nh1; { go check next day}